﻿using System.Collections.Generic;
using System.Linq;
using CID.Domain.Audit;
using CID.Domain.Development;
using CID.Domain.Operations;
using CID.Domain.Users;

namespace CID.Web.Models.Audit
{
    public class ReleaseDeploymentLogListViewModel
    {
        public IEnumerable<ReleaseDeploymentLog> ReleaseDeploymentLogs { get; private set; }
        public IEnumerable<IRelease> FilterReleases { get { return ReleaseDeploymentLogs.Select(x => x.Release).Distinct(); } }
        public IEnumerable<IEnvironment> FilterEnvironments { get { return ReleaseDeploymentLogs.Select(x => x.Environment).Distinct(); } }
        public IEnumerable<DeploymentStatus> FilterStatus { get { return ReleaseDeploymentLogs.Select(x => x.Status).Distinct(); } }
        public IEnumerable<IUser> FilterResponsibles { get { return ReleaseDeploymentLogs.Select(x => x.Responsible).Distinct(); } }

        public ReleaseDeploymentLogListViewModel(IEnumerable<ReleaseDeploymentLog> releaseDeploymentLogs)
        {
            ReleaseDeploymentLogs = releaseDeploymentLogs;
        }
    }
}